package com.bup.gn.utils.exceptions.handler;

import com.bup.gn.utils.exceptions.ExceptionInfo;

/**
 * This class is used for logging the exceptions in a file using a logger as
 * well as getting the error code against a checked application exception.
 *
 * @author ShriKant
 * @version 1.0
 */
public class FileLoggingExceptionHandler implements IExceptionHandler {

    /**
     * No argument constructor
     */
    public FileLoggingExceptionHandler() {
    }

    public ExceptionInfo handleException(String context, String userId,
                                         Throwable exp) {
        ExceptionInfo exDTO = ExceptionUtil.getExceptionDetails(context, exp);
        ExceptionUtil.logException(this.getClass(), exp, userId, exDTO
                .getLoggingType());
        return exDTO;
    }
}